import request from "@/utils/request";
import { getParamsSuffix } from "@/utils/paramsUtils";


/**
 * 分页
 * @param params
 * @returns {Promise<any>}
 */
export async function listAllTableData(params) {
    return request('/api/cdcerservice/v1/cerSysteminitImportOfficialInfo/listAllTableData', {
        method: 'POST',
        requestType: 'form',
        data: { ...params },
    });
}


/**
 * 详情
 * @param query
 * @returns {Promise<any>}
 */
export async function findDataById(query) {
    const params = getParamsSuffix(query);
    return request(`/api/cdcerservice/v1/cerSysteminitImportOfficialInfo/findDataById?${params}`);
}

/**
 * 回退
 * @param params
 * @returns {Promise<any>}
 */
export async function DeleteDataById(params) {
    return request('/api/cdcerservice/v1/cerSysteminitImportOfficialInfo/DeleteDataById', {
        method: 'POST',
        requestType: 'form',
        data: { ...params },
    });
}

/**
 * 点击导出所有信息
 * @returns {Promise<any>}
 * @param params
 */
export async function queryAllExportData(params) {
    return request(`/api/cdcerservice/v1/cerSysteminitImportOfficialInfo/queryAllExportData`, {
        method: 'POST',
        requestType: 'form',
        responseType: 'blob',
        data: {
            ...params
        }
    });
}

/**
 * 数据推送至国家平台
 * @param params
 * @returns {Promise<any>}
 */
export async function pushNation(params) {
    let ids = []
    for (const key in params) {
        ids.push(params[key])
    }
    console.log(ids);
    return request('/api/cdcerserver/v1/cerSysteminitImportOfficialInfo/pushNation', {
        method: 'POST',
        data: ids,
    });
}